{% extends "admin/base_site.html" %}
{% load i18n static %}
{% load widget_tweaks %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" href="{% static "css/login.css" %}">
{{ form.media }}
{% endblock %}

{% block bodyclass %}{{ block.super }} login-page bg-body-secondary{% endblock %}

{% block containerclass %} login-box{% endblock %}

{% block header %}
<div class="login-logo">
  <a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a>
</div>
{% endblock %}

{% block nav-breadcrumbs %}{% endblock %}


{% block mainclass %} card{% endblock %}
{% block nav-sidebar %}{% endblock %}
{% block contentstartclass %} card-body login-card-body{% endblock %}

{% block content_title %}

<p class="login-box-msg">
{% if user.is_authenticated %}
{% blocktranslate trimmed %}
    You are authenticated as {{ username }}, but are not authorized to
    access this page. Would you like to login to a different account?
{% endblocktranslate %}

{% else %}
请输入用户名和密码
{% endif %}
</p>
{% endblock %}


{% block content %}
{% if form.errors and not form.non_field_errors %}
<p class="login-box-msg">
{% blocktranslate count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktranslate %}
</p>
{% endif %}

{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<p class="login-box-msg">
    {{ error }}
</p>
{% endfor %}
{% endif %}

<div id="content-main">

  <form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
    <div class="input-group mb-3">
      {{ form.username.errors }}
      {% render_field form.username class="form-control" placeholder=form.username.label %}
      <div class="input-group-text"><span class="bi bi-envelope"></span></div>
    </div>
    <div class="input-group mb-3">
      {{ form.password.errors }}
      {% render_field form.password class="form-control" placeholder=form.password.label %}
      <div class="input-group-text"><span class="bi bi-lock-fill"></span></div>
    </div>

    <!--begin::Row-->
    <div class="row">
      
      <div class="col-8">
      {% url 'admin_password_reset' as password_reset_url %}
      {% if password_reset_url %}
        <div class="password-reset-link">
          <a href="{{ password_reset_url }}">{% translate 'Forgotten your password or username?' %}</a>
        </div>
      {% endif %}
      </div>
      
      <!-- /.col -->
      <div class="col-4">
        <div class="d-grid gap-2">
          <button type="submit" class="btn btn-primary">{% translate 'Log in' %}</button>
        </div>
      </div>
      <!-- /.col -->
    </div>
    <!--end::Row-->
  </form>

</div>
{% endblock %}
